/* GUI CONVERTED from rsrp07a.p (converter v1.76) Mon Sep 24 06:28:44 2001 */
/* rsrp07a.p - Release Management Supplier Schedules                          */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.5.1.2 $                                                       */
/*V8:ConvertMode=Report                                                       */
/* REVISION: 7.3    LAST MODIFIED: 10/06/92   BY: WUG *G462*                  */
/* REVISION: 7.3    LAST MODIFIED: 07/14/93   BY: WUG *GD42*                  */
/* REVISION: 7.3    LAST MODIFIED: 04/08/94   BY: WUG *GJ29*                  */
/* REVISION: 8.6    LAST MODIFIED: 10/07/97   BY: GYK *K0MT*                  */
/* REVISION: 8.6E   LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane            */
/* REVISION: 8.6E   LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan           */
/* REVISION: 9.1    LAST MODIFIED: 07/27/00   BY: *N0GV* Rajinder Kamra       */
/* Old ECO marker removed, but no ECO header exists *F0PN*                    */
/* $Revision: 1.5.1.2 $  BY: Jean Miller         DATE: 09/17/01  ECO: *N12P*  */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

/* SHIPPING SUMMARY REPORT SUBPROGRAM */


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

{mfdeclre.i}
{gplabel.i}

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE rsrp07a_p_3 "Day/Week/Month"
/* MaxLen: Comment: */

&SCOPED-DEFINE rsrp07a_p_7 "Per Column"
/* MaxLen: Comment: */

&SCOPED-DEFINE rsrp07a_p_14 "Start Date"
/* MaxLen: Comment: */

&SCOPED-DEFINE rsrp07a_p_15 "Sort Option"
/* MaxLen: Comment: */

/* ********** End Translatable Strings Definitions ********* */

{wbrp02.i}

define shared variable supplier_from like po_vend.
define shared variable supplier_to like po_vend.
define shared variable shipto_from like po_ship.
define shared variable shipto_to like po_ship.
define shared variable part_from like pod_part.
define shared variable part_to like pod_part.
define shared variable po_from like po_nbr.
define shared variable po_to like po_nbr.
define shared variable buyer_from like po_buyer.
define shared variable buyer_to like po_buyer.
define shared variable sortoption as integer label {&rsrp07a_p_15}
   format "9" initial 1.
define shared variable sortextoption as character extent 3 format "x(34)".

define shared variable start as date label {&rsrp07a_p_14}.
define shared variable sdate as date extent 14.
define shared variable interval as integer extent 14.
define shared variable dwm as character format "x(1)" label {&rsrp07a_p_3}.
define shared variable idays as integer format ">9"   label {&rsrp07a_p_7}.
define variable monthend as integer.
define shared variable num_intervals as integer initial 13.
define variable i as integer.

define variable net_req as decimal.
define variable cum_net_req as decimal.
define variable prior_cum_net_req as decimal.
define variable cum_net_req_bucket as decimal format ">>>>>>>9" extent 13.
define variable net_req_bucket as decimal format ">>>>>>>9" extent 13.
define variable nonwdays as integer.
define variable workdays as integer extent 14 format "->>>,>>9".
define variable overlap as integer.

FORM /*GUI*/  with STREAM-IO /*GUI*/  frame heading width 132.  /* SCOPE TO PROGRAM */
for each po_mstr no-lock
   where po_nbr >= po_from and po_nbr <= po_to
     and po_vend >= supplier_from and po_vend <= supplier_to
     and po_buyer >= buyer_from and po_buyer <= buyer_to,
    each pod_det no-lock
   where pod_nbr = po_nbr
     and pod_sched
     and pod_part >= part_from and pod_part <= part_to
     and pod_site >= shipto_from and pod_site <= shipto_to
     and pod_nbr >= po_from and pod_nbr <= po_to,
    each sch_mstr no-lock
   where sch_type = 4 and sch_nbr = pod_nbr and sch_line = pod_line
     and sch_rlse_id = pod_curr_rlse_id[1]
break by pod_site by po_vend by pod_part by po_nbr:

   if first-of(po_vend) then do:

      find ad_mstr where ad_addr = po_vend no-lock no-error.

      display
         skip(1)
         getTermLabelRtColon("SHIP-TO_SITE",13) format "x(13)"
         pod_site
         getTermLabelRtColon("SUPPLIER",13) format "x(13)" to 13
         po_vend
         ad_name                       when (available ad_mstr)
         skip(1)
         space(14)
         getTermLabel("PAST",8)
         sdate[2 for 12]
         skip space(14)
         sdate[2] - 1
         sdate[3] - 1
         sdate[4] - 1
         sdate[5] - 1
         sdate[6] - 1
         sdate[7] - 1
         sdate[8] - 1
         sdate[9] - 1
         sdate[10] - 1
         sdate[11] - 1
         sdate[12] - 1
         sdate[13] - 1
         sdate[14] - 1
         skip space(14)
         "-------- -------- -------- -------- -------- -------- --------"
         "-------- -------- -------- -------- -------- --------"
      with frame heading page-top width 132 no-box no-attr-space no-labels STREAM-IO /*GUI*/ .

   end.

   assign
      net_req_bucket = 0
      prior_cum_net_req = max(sch_pcr_qty - pod_cum_qty[1],0).

   {rcrp07.i &date=sch_pcs_date &qty=prior_cum_net_req}

   for each schd_det no-lock
      where schd_type = sch_type
        and schd_nbr = sch_nbr
        and schd_line = sch_line
        and schd_rlse_id = sch_rlse_id
   by schd_date by schd_time:
      assign
         cum_net_req = max(schd_cum_qty - pod_cum_qty[1],0)
         net_req = cum_net_req - prior_cum_net_req
         prior_cum_net_req = cum_net_req.
      {rcrp07.i &date=schd_date &qty=net_req}
   end.

   assign
      cum_net_req_bucket = 0
      cum_net_req = 0.

   do i = 1 to num_intervals:
      assign
         cum_net_req = cum_net_req + net_req_bucket[i]
         cum_net_req_bucket[i] = cum_net_req.
   end.

   assign
      workdays = 0
      interval[1] = ?.

   do i = 2 to num_intervals:
      interval[i - 1] = sdate[i] - sdate[i - 1].
   end.

   {mfcwdays.i pod_site}

   display
      getTermLabelRtColon("ITEM_NUMBER",12) format "x(12)"
      space(1)
      pod_part
      space(2)
      getTermLabelRtColon("UNIT_OF_MEASURE",3) format "x(3)"
      space(1)
      pod_um
      space(1)
      getTermLabelRtColon("PURCHASE_ORDER",16) format "x(16)"
      space(1)
      po_nbr
      space(2)
      getTermLabelRtColon("BUYER",6) format "x(6)"
      po_buyer
      space(1)
      getTermLabelRtColon("RELEASE_ID",12) format "x(12)"
      space(1)
      sch_rlse_id
      skip(1)
      getTermLabel("WORKDAYS",13) format "x(14)"
      "" @ workdays[1]
      workdays[2 for 12]
      skip
      getTermLabel("NET_QTY_DUE",13) format "x(14)"
      net_req_bucket[1 for 13]
      skip
      getTermLabel("CUM_QTY_DUE",13) format "x(14)"
      cum_net_req_bucket[1 for 13]
      skip(2)
   with width 132 no-box no-attr-space no-labels STREAM-IO /*GUI*/ .

   
/*GUI*/ {mfguichk.i  &warn=false} /*Replace mfrpchk*/


   if last-of(po_vend) then do:
      hide frame heading.
      page.
   end.

end.

{wbrp04.i}
